import {request} from "@umijs/max";


export async function getAllRedPackets(params: REDPACKET.GetAllRedPacketParams, options?: { [key: string]: any }) {
  // 将 params 对象转换为查询字符串
  const queryString = new URLSearchParams(params as any).toString();

  return request<{
    data: REDPACKET.GetAllRedPacketResult
  }>(`/redpacket/searchRedPacket?${queryString}`, {
    method: 'GET',
    // params: {
    //   ...params
    // },
    ...(options || {}),
  });
}

export async function getRedPacketStatistics(params: REDPACKET.RedPacketStatisticsParams, options?: { [key: string]: any }) {
  return request<{
    data: REDPACKET.RedPacketStatisticsResult
  }>('/statistics/redPacketStatistics', {
    method: 'GET',
    params: {
      ...params
    },
    ...(options || {}),
  });
}
